package my.graduation.controller.doctor;

import my.graduation.dto.ClinicInfoDto;
import my.graduation.dto.DocRegScheDto;
import my.graduation.dto.ExamItemDto;
import my.graduation.entity.Department;
import my.graduation.entity.ExaminationItem;
import my.graduation.result.Result;
import my.graduation.service.ClinicService;
import my.graduation.service.DepartmentService;
import my.graduation.service.ExaminationItemService;
import my.graduation.vo.ClinicVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: RavenLyn
 * @Date: 2024-12-15
 */
@RestController
@RequestMapping("/doctor")
public class DocDepartClinicExamController {

    @Autowired
    private DepartmentService departService;
    @Autowired
    private ClinicService clinicService;
    @Autowired
    private ExaminationItemService examItemService;

    /**
     * 医生根据clinicId获取ClinicName
     * @param dto
     * @return
     */
    @PostMapping("/clinic/name")
    public Result<String> getClinicName(@RequestBody DocRegScheDto dto){
        return clinicService.getNameById(dto);
    }


    /**
     * 医生获取科室信息departmentList
     * @return
     */
    @GetMapping("/depart")
    public Result<List<Department>> getDepartList(){
        return departService.getDepartList();
    }

    /**
     * 医生根据条件(departmentId)获取门诊信息clinicList
     * @param dto
     * @return
     */
    @PostMapping("/clinic/con")
    public Result<List<ClinicVO>> getClinicListByCon(@RequestBody ClinicInfoDto dto){
        return clinicService.getListByCon(dto);
    }

    /**
     * 医生根据条件(clinicId)获取检查项目信息itemList
     * @param dto
     * @return
     */
    @PostMapping("/exam_item/con")
    public Result<List<ExaminationItem>> getItemListByCon(@RequestBody ExamItemDto dto)
    {
        return examItemService.getListByCon(dto);
    }

    /**
     * 医生获取所有检查项目信息itemList
     * @return
     */
    @GetMapping("/exam_item")
    public Result<List<ExaminationItem>> getAllItemList()
    {
        return examItemService.getAllItemList();
    }
}
